//
//  UIBarButtonItem+Extension.swift
//  Weibo
//
//  Created by eju_wangzhenxing on 16/11/7.
//  Copyright © 2016年 qisitianxia. All rights reserved.
//

import UIKit


extension UIBarButtonItem {

    convenience init(title: String, titleFontSize: CGFloat, target: Any?, action: Selector, isBack: Bool = false) {
        
        let btn: UIButton = UIButton.zx_Custom(title: title, titleFontSize: titleFontSize, normalColor: UIColor.darkGray, highlighted: UIColor.orange)
        btn.addTarget(target, action: action, for: .touchUpInside)
        
        if isBack {
            
            let imageName = "navigationbar_back_withtext"
            
            btn.setImage(UIImage.init(named: imageName), for: .normal)
            btn.setImage(UIImage.init(named: imageName + "_highlighted"), for: .highlighted)
            
            btn.sizeToFit()
        }
        
        self.init(customView: btn)
    }
}

